/*var position_name,position_code,section
function selects(){
	position_name=$("#position_name").val();
	section=$("#section").val();
	alert(position_name);
	alert(section);
}*/
var position_name,position_code,section;
var path=$("#path").val();
function Myfile() {
	$('#table').bootstrapTable(
					{
						method : "get",
						url :path+"/show_position.json",
						striped : true,
						//设置true将禁止多选
						singleSelect : true,
						dataType : "json",
						pagination : true, // 分页
						pageSize : 5,
						pageNumber : 1,
						search : false, // 显示搜索框
						contentType : "application/x-www-form-urlencoded",
						queryParams : null,
						columns : [
							{
								title : "选择",
				                checkbox:"true",
				                align: 'center',
				                valign: 'middle'
				            },
								{
									title : "职位编码",
									field : 'position_code',
									align : 'center',
									valign : 'middle'
								},
								{
									title : "职位名称",
									field : 'position_name',
									align : 'center',
									valign : 'middle'
								},
								{
									title : "职位分类",
									field : 'posClassName',
									align : 'center',
									valign : 'middle'
								},

								{
									title : '所属部门',
									field : 'department',
									align : 'center',
									valign : 'middle'
								},
								{
								visible: false,//隐藏列
								field :'id',
								align : 'center',
								valign : 'middle',
									
							},
								 ]
					});
	getType();
	selects();
}

//确定
function yes(){
	var row = $.map($('#table').bootstrapTable('getSelections'),function (row) {
		var position_id=row["id"];
		var p_name=row["position_name"];
		var p_code=row["position_code"];
		var p_oz_name=row["department"];
		document.getElementById("position_id").value = position_id;
		document.getElementById("position_name").value = p_name;
		document.getElementById("position_code").value = p_code;
		document.getElementById("oz_name").value = p_oz_name;
		$("#ds").hide();
	});
}
//初始化类型下拉菜单
function getType() {
	$.ajax({
				url :path+'/oz_names.json',
				type : 'GET',
				dataType :'json',
				success : function(data) {
					var TYPEValue = data.data;
					var TYPEItem = "<Option value = " + "0" + ">" + "请选择"
							+ "</Optioan>";
					$("#section").append(TYPEItem);
					for (var i = 0; i < TYPEValue.length; i++) {
						var htmls = "<Option value = '" + TYPEValue[i].id
								+ "'>" + TYPEValue[i].oz_name + "</Option>";
						$("#section").append(htmls);
					}
				},
				error : function(err) {
				}

			})
			
}

//查询职位数据
function selects(){
	position_name=$("#p_name").val();
	position_code =$("#p_code").val();
	section=$("#section").val();

	$.ajax({
		type : "GET",
		url :"show_position.json",
		data : {
			"position_name" : position_name,
			"position_code" : position_code,
			"department_Id" : section
		},
		success : function(result) {
			if (result.data) {
				var TableData = result.data;
				$('#table').bootstrapTable("load", TableData);//刷新
			}
		}
	})
}

	

















